Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add integration test for /var mounts #6033

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

TheRealFalcon
Copy link
Member

Proposed Commit Message

test: Add integration test for /var mounts

Additional Context

Test Steps

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TheRealFalcon, this is looking really nice! I left some nitpicks below.

crit_chain = client.execute(
f"systemd-analyze critical-chain {service} --fuzz=60"
)
assert "var.mount" in crit_chain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a failure message here? Currently when this fails we see:

 assert 'var.mount' in 'The time when unit became active or started is printed after the "@" character.\nThe time the unit took to start is printed after the "+" character.\n\ncloud-init-...

Which is a bit cryptic without context

f"systemd-analyze critical-chain {service} --fuzz=60"
)
assert "var.mount" in crit_chain
assert crit_chain.find("var.mount") > crit_chain.find(service)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if it offered a machine readable output format, but that doesn't seem to be the case (yet?).

If the service isn't available on in the critical chain, we would get a false positive (PASS) on this test. There would be bigger issues at play, but for easier maintenance I think that failing in that case would be more correct.

That said, I think that systemctl list-dependencies --all {service} would be more correct than using the critical chain, right?

Also, same comment as above about explaining why the failure matters.

Would you mind checking cloud-init logs/status here too, just for good measure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we'd get a false positive, but I think systemctl makes more sense than some arbitrary fuzz value so I'll do that. +1 to everything else here too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we'd get a false positive

 str.find(sub[, start[, end]])

     ...
     Return -1 if sub is not found.

-1 would be smaller than the integer returned by crit_chain.find("var.mount")

@TheRealFalcon
Copy link
Member Author

@holmanb I believe I addressed your comments

Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @TheRealFalcon!

@TheRealFalcon TheRealFalcon merged commit 7ddc766 into canonical:main Feb 20, 2025
22 checks passed
@TheRealFalcon TheRealFalcon deleted the var-test branch February 20, 2025 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants